<div class="content">
<h1>权限列表</h1>
<%= render :partial => "search" %>
<table class="table">
  <tr>
    <th>名称</th>
    <th>描述</th>
    <th>操作</th>
  </tr>

<% @permissions.each do |permission| %>
  <tr>
    <td><%=h permission.name %></td>
    <td><%=h permission.description %></td>
    <td>
   <%= link_to_function '修改', "$('permission#{permission.id}').toggle()" %>|
    <%= link_to '删除', admin_permissions_path(permission), :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>


      <% form_for([:admin ,permission], :html=> {:class => 'form'}) do |f| %>
    
        <tr id="permission<%=  permission.id %>" style ='display:none' class = 'form'>
        <td>
          <%= f.text_field :name,:class =>'text_field' , :size => 3 %>
        </td>      
        <td>
          <%= f.text_field :description,:class =>'text_field'  , :size => 3 %>
        </td>
        <td>
          <%= f.submit '修改' ,:class =>'button' %>  
        </td>
      </tr>
    <% end %>
<% end %>
</table>
<%= will_paginate  @permissions %>
<br />

<%= link_to '添加权限', new_admin_permission_path %>
</div>